#pragma once

#include "../Core/LinearCombination3.h"
#include "../Core/RealSquareMatrices.h"

namespace cagd
{
    class CyclicCurve3: public LinearCombination3
    {
    protected:
        GLuint           _n;         // order
        GLdouble         _c_n;       // normalizing constant
        GLdouble         _lambda_n;  // phase change

        RealSquareMatrix _bc;        // binomial coefficients

        GLdouble         _CalculateNormalizingCoefficient(GLuint n);

        GLvoid           _CalculateBinomialCoefficients(GLuint m, RealSquareMatrix &bc);

    public:
        CyclicCurve3(GLuint n, GLenum data_usage_flag = GL_STATIC_DRAW);

        GLboolean BlendingFunctionValues(GLdouble u, RowMatrix<GLdouble>& values) const;
        GLboolean CalculateDerivatives(GLuint max_order_of_derivatives, GLdouble u, Derivatives& d) const;

        GLdouble Length(GLuint div_point_count) const;

    };
}
